package com.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.entity.Visit;
import com.service.impl.VisitServiceImpl;

import cn.hutool.extra.tokenizer.Result;
import java.util.Map;

import java.util.ArrayList;
import java.util.List;

@SuppressWarnings({"all"})
@RestController
@CrossOrigin(origins = "*")
@RequestMapping("/visit")
public class VisitController {
    @Autowired  
    VisitServiceImpl visitServiceImpl;

    //  list已测试,可用
    @GetMapping("/list")
    public List<Visit> getAllVisits() {  
        return visitServiceImpl.findAll();  
    }

    @GetMapping("/selectlist")
    public List<Visit> getListState(Visit visit)
    {
        return visitServiceImpl.selectUntreated(visit);
    }

    @PostMapping("/update")  
    public void updateVisit(int visitId, String diagnosisName, String hospitalDepartment , String describtion, int bedNumber, String state, String start, String end, Map<String,Integer> drugList) {
        visitServiceImpl.updateVisitById(visitId,diagnosisName,hospitalDepartment,describtion,bedNumber,state,start,end,drugList);   
    }  
}